import sqlite3
from typing import Optional, List, Any
DB_PATH = "./lab01.db"

def execute_sql(
    path: str, multi_queries: bool = False, is_fetch: bool = False
) -> Optional[List[Any]]:
    with sqlite3.connect(DB_PATH) as connection:
        cursor: sqlite3.Cursor = connection.cursor()
        with open(path, "r", encoding="utf-8") as sql_file:
            if multi_queries:
                cursor.executescript("".join(sql_file.readlines()))
            else:
                cursor.execute("".join(sql_file.readlines()))
        result = cursor.fetchall() if is_fetch else None
        cursor.close()
    return result